The present invention relates to a microcomputer and, more particularly, to a microcomputer comprising a nonvolatile flash memory to and from which data may be written and erased electrically.
Illustratively, EPROM""s are writable nonvolatile memories whose data is erased by use of ultraviolet rays. This means that these memories need to be detached from the systems incorporating them for the erasure and writing of data therefrom and thereto.
By contrast, flash memory EEPROM""s have data written and erased thereto and therefrom electrically. It follows that these memories may remain installed in their respective systems while the memory data is being updated.
One means for updating data in the EEPROM""s is a serial communication interface. In the typical serial communication setup, the baud rate on the host computer side is fixed while the baud rate of the microcomputer using the memory is determined by the operating frequency of the microcomputer. A suitable value representing the baud rate so determined is set in a register of the serial communication interface.
The above prior art setup involves the use of the serial communication interface in the microcomputer for communication with an externally located host computer. In that case, it is necessary to determine beforehand the baud rate of data transmission on the host computer side and to set the corresponding baud rate value in a register of the internal serial communication interface to comply with the baud rate requirements of the host computer. In addition, the setting in the register needs to be modified depending on the operating frequency of the microcomputer.
One disadvantage of the prior art is that the conventional start-stop transmission system based on the serial communication interface requires keeping the register value updated in accordance with the baud rate of the host computer for data transmission as well as with the operating frequency of the microcomputer. Another disadvantage is that the time required to update data in the flash memory of the microcomputer needs to be changed depending on the user-designated operating frequency of the microcomputer.
It is therefore an object of the present invention to provide a microcomputer capable of automatically setting the baud rate of its serial communication interface for start-stop transmission to a communicating party while the microcomputer remains installed in its system, so that the microcomputer may transmit data to the communicating party at a desired baud rate without regard to the operating frequency of the microcomputer.
It is another object of the invention to provide a microcomputer capable of updating data in the flash memory incorporated therein in accordance with the user-designated operating frequency of the microcomputer.
Other objects, features and advantages of the present invention will become apparent in the following specification and accompanying drawings.
The major features of what is disclosed in this application are outlined as follows:
The microcomputer embodying the invention comprises on a single semiconductor chip at least a central processing unit (CPU) and a nonvolatile flash memory to and from which the data to be processed by the CPU may be written and erased electrically. The microcomputer provides an operation mode in which to update data in the flash memory using the serial communication interface, the baud rate of the serial communication interface being adjusted automatically with respect to the baud rate of the host computer.
In the operation mode above, the CPU controls the updating of data in the flash memory and serial communication operations. The program for controlling the CPU is held in the flash memory or in a mask ROM.
The program for controlling the CPU includes a measuring process in which the CPU measures the xe2x80x9cLowxe2x80x9d or xe2x80x9cHighxe2x80x9d period of serial data sent from the communicating party; a calculating process in which to calculate the baud rate of the communicating party based on the Low or High period so measured; a setting process in which to set the baud rate so calculated into a register of the serial communication interface; and a receiving process in which to receive programs and data from the communicating party.
As mentioned, the program for controlling the CPU is held in the flash memory or in the mask ROM. Resetting the operation mode executes this control program. The area holding the control program in the memory is not selected if any instruction is fetched from somewhere other than this area.
Activating the above operation mode triggers verification of the data in flash memory areas other than the area holding the control program. In the verifying process, if there is found to exist already-written data outside the area holding the control program, these data areas outside the control program area are erased.
With the microcomputer of the invention, the program for controlling the CPU includes the measuring, calculating, setting and receiving processes. The control program offering these processes is activated by resetting the operation mode in which to update data in the flash memory. The control program then measures the xe2x80x9cLowxe2x80x9d or xe2x80x9cHighxe2x80x9d period of serial data from the communicating party, calculates the baud rate of the communicating party based on the Low or High period so measured, and sets automatically the baud rate so calculated into a register of the serial communication interface. Upon reception, the microcomputer receives programs or data from the communicating party at the baud rate thus calculated without regard to the operating frequency of the microcomputer.
That is, when the microcomputer communicates with an externally furnished host computer (i.e., the communicating party), the microcomputer first measures the Low or sigh period of data sent from the host computer, calculates the baud rate of the host computer from the period so measured, and sets the calculated baud rate value in a baud rate register of the internal serial communication interface. This allows the microcomputer to communicate with the external host computer at the same baud rate.
The control program is stored in a part of a flash memory or in a mask ROM. The control program so stored is readily executed by setting appropriate terminals for the operation mode in which to update data in the flash memory using the serial communication interface.
If an instruction is fetched from somewhere outside the control program holding area, that area is not selected. If any data has been written outside the control program holding area, all data outside that area is erased. In this manner, the data in the flash memory is protected and secured.
For the erase operation, it is possible to set a suitable memory erasure time based on the calculated bit rate and regardless of the operating frequency of the microcomputer, the erasure time being such as not to let the flash memory be erased more than is required.
With the microcomputer remaining installed in its system, data may be received from the communicating party by serial communication at any baud rate and regardless of the operating frequency of the microcomputer, whereby the content of the flash memory inside the microcomputer is updated easily.